Component({
  /**
   * 组件的属性列表
   */
  properties: {
    range: Array,
    title: String,
    field: String,
  },

  /**
   * 组件的初始数据
   */
  data: {
    show: false,
    active: '',
    value: "请输入"
  },
  observers: {
    'value'() {
      this.setData({ active: 'active' })
    },
  },
  /**
   * 组件的方法列表
   */
  methods: {
    onFilterInputTap() {
      this.setData({ show: true })
    },
    onSelectItemTap(event: WechatMiniprogram.Input) {
      const value = event.currentTarget.dataset.value
      this.setData({ value, })
      this.setData({ show: false })
      const fieldValue = {} as any
      fieldValue[this.data.field] = this.data.range.indexOf(value) + ''
      this.triggerEvent("click", fieldValue, { bubbles: true, composed: true })
    }
  }
})
